﻿<!DOCTYPE html>
<!--整改-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <style>
        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }
        body {
            padding-bottom: 10px;
        }
    </style>
    <style>
        /*说明：
         由于mystyle.css中162行.el-form-item__content {line-height: normal!important;}导致的
         index.css中.el-form-item--mini .el-form-item__content, .el-form-item--mini .el-form-item__label{    line-height: 28px;}失效
         但出于无法修改样式表的情况，所以在该页面添加以下样式，以保证页面内标题和内容不偏离
        */
        .el-form-item--mini .el-form-item__content,
        .el-form-item--mini .el-form-item__label {
            line-height: 28px !important;
        }
        .el-input__suffix{
            right:auto!important;
        }
    </style>
    <style>
        ._delete-icon {
            position: absolute;
            right: 5px;
            bottom: 13px;
            cursor: pointer;
            display: none;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW150">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" size="mini" label-position="right">

            <el-row>
                <el-col :span="15">
                    <el-form-item :label="RisksManagement.Rectification.RiskDescription+mark.m" class="inputTextarea">
                        {{Form.RiskDescription}}
                    </el-form-item>

                </el-col>
                <el-col :span="7" offset="2">
                    <el-link :underline="false" @click="OpenRiskDetails" type="primary"
                        style="font-size: 14px;color:#409eff;cursor:pointer;">
                        {{RisksManagement.RiskAcceptance.RiskDetails}}</el-link>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.RectificationCase+mark.m" class="inputTextarea">
                        {{Form.RectificationCase}}
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input type="text" v-model="Form.RectificationFund" autocomplete="off" size="mini"
                                    disabled="disabled">
                                    <template slot="prepend">
                                        {{RisksManagement.Rectification.RectificationFund+mark.m}}
                                    </template>
                                </el-input>
                            </el-form-item>

                        </div>
                    </el-col>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.Rectification.SetRectificationLeading+mark.m"
                                class="inputTextarea">
                                {{Form.SetRectificationLeading}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.Rectification.Department+mark.m"
                                class="inputTextarea">
                                {{Form.Department}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.Rectification.SetRectificationer+mark.m"
                                class="inputTextarea">
                                {{Form.SetRectificationer}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-form-item>
                        <div class="elst-select-mini">
                            <!-- <el-input size="mini" disabled="disabled">此处不加disabled="disabled" -->
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.Rectification.PlanTime+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.PlanTime" type="date" size="mini"
                                                format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
                                    placeholder="选择时间" disabled="disabled">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>

                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{RisksManagement.Rectification.HaveContingencyPlan+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.HaveContingencyPlan" slot="suffix"
                                    :placeholder="RisksManagement.Rectification.HaveContingencyPlan"
                                    @change="ShowPlan($event)" disabled="disabled">
                                    <el-option label="否" value="0"></el-option>
                                    <el-option label="是" value="1"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

            </el-row>
            <el-row v-if="ShowEmergencyPlan">
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.EmergencyPlan+mark.m" prop="EmergencyPlan"
                        class="inputTextarea">
                        <el-input type="textarea" v-model="Form.EmergencyPlan" autocomplete="off" disabled="disabled">
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.CurrentPlan+mark.m" prop="CurrentPlan"
                        class="inputTextarea">
                        <el-input type="textarea" v-model="Form.CurrentPlan" autocomplete="off" disabled="disabled">
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.Rectification.ActualTime+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.ActualTime" type="date" size="mini"
                                                format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
                                    placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.RectificationDescription+mark.m"
                        prop="CurrentPlan" class="inputTextarea">
                        <el-input type="textarea" v-model="Form.RectificationDescription" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row style="    min-height: 114px;">
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.Rectification.RectificationImg+mark.m" prop="RectificationImg"
                        class="inputTextarea" style="position:relative;">
                        <el-upload class="upload-demo" :show-file-list="false" accept=".jpg,.jpeg,.png,.gif" action=""
                            :limit="1" :on-change="UploadChange" style="margin-left:0;">
                            <el-button type="primary">{{col.btnUpLoad}}</el-button>
                        </el-upload>
                        <div v-for="src in Form.RectificationImg" style="float:left;margin-right:5px;position:relative;"
                            class="ImgBox">
                            <i class="el-icon-delete _delete-icon" @click="deleteImg(src.id)"></i>
                            <img :src="src.Img" width="200" height="100" />
                        </div>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        {{RisksManagement.Rectification.Acceptancer+mark.m}}
                                    </template>
                                    <treeselect v-model="Form.Acceptancer" :options="Acceptancer" :flat="true"
                                        :show-count="true" :disable-branch-nodes="true" slot="suffix"
                                        style="line-height:28px;width:60%;float: right;" placeholder="请选择" />
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSubmit}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog :title="RisksManagement.RiskAcceptance.RiskDetails" :visible.sync="ListItem.dialogVisible"
            width="80%" height="80%" top="10vh"   fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script>
        //图片删除图标
        $(function () {
            $('body').on('mouseenter mouseleave', 'img', function (e) {
                if (e.type == 'mouseenter') {
                    $(this).prev("i").show();
                }
                else if (e.type == 'mouseleave') {
                    $(this).prev("i").hover(function () {
                        $(this).show()
                    }).hide()
                }
            })
        })
    </script>
    <script type="text/javascript">

        app = new Vue({
            el: '#app',
            data: {
                //父业传参
                id: '',
                Region: myTree,
                mydata: PersonInChargeTree,
                ShowEmergencyPlan: false,
                ListItem: ListItem,
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    RiskDescription: '',
                    RectificationCase: '',
                    RectificationFund: '',
                    SetRectificationLeading: null,
                    Department: '',
                    SetRectificationer: null,
                    HaveContingencyPlan: '0',
                    PlanTime: '',
                    CurrentPlan: '',
                    EmergencyPlan: '',
                    RectificationImg: [],
                    Acceptancer: null,
                    ActualTime: '',
                    RectificationDescription: '',
                },
                SetRectificationLeading: [],
                Department: [],
                SetRectificationer: [],
                HaveContingencyPlan: [],
                Acceptancer: [],
                //表单验证
                rules: {

                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //隐患记录详细信息
                OpenRiskDetails: function () {
                    DialogShow(this, 'xg', "RiskRecordView.html", this.id);
                },
                //上传状态改变事件，随便选个可触发的钩子模拟上传
                UploadChange: function (file, filelist) {
                    if (file.status == 'ready') {
                        console.log('this.Form.RectificationImg', this.Form.RectificationImg)
                        this.Form.RectificationImg.push({
                            id: Mock.Random.id(),
                            Img: Mock.Random.image('200x100', '#1989fa', '#FFFFFF', 'Test Image' + ($(".ImgBox").length + 1)),
                        });
                    }
                    else if (file.status == 'fail') {
                        console.log('uploadfail')
                    }
                },
                //图片临时删除
                deleteImg: function (id) {
                    var list = this.Form.RectificationImg;
                    this.$confirm(' 是否确认继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(function () {
                        list.forEach(function (v, i) {
                            if (v.id + '' === id + '') {
                                list.splice(i, 1);
                            }
                        })
                    }).catch(function () {
                        showMessage("已取消删除!");
                    });
                },
                ShowPlan: function (val) {
                    if (val === '1')
                        this.ShowEmergencyPlan = true;
                    else
                        this.ShowEmergencyPlan = false;
                },
                //提交数据
                onSubmitForm: function (formName) {
                    //如果应急预案选择否，则应急预案内容清空
                    if (this.Form.HaveContingencyPlan == '0') {
                        this.Form.EmergencyPlan = '';
                    }
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/Rectification/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });

                },
                getData: function () {

                    getData(this, '/api/Rectification/get?id=' + this.id);
                    this.RiskPosition = [];
                    this.RiskPosition = fn(this.mydata, this.Form.RegionName);
                },

            },
            mounted: function () {
                this.SetRectificationLeading = fn(this.mydata, "0");
                this.Department = fn(this.Region, "0");
                this.SetRectificationer = fn(this.mydata, "0");
                this.Acceptancer = fn(this.mydata, "0");
                this.id = getUrlParam("id");
                this.getData();


                this.Form.SetRectificationLeading = getTreeValue(this.mydata, this.Form.SetRectificationLeading);
                this.Form.Department = getTreeValue(this.Region, this.Form.Department);
                this.Form.SetRectificationer = getTreeValue(this.mydata, this.Form.SetRectificationer);

                if (this.Form.EmergencyPlan) {
                    this.ShowEmergencyPlan = true;
                    this.Form.HaveContingencyPlan = '1';
                }
            }
        });
    </script>
</body>

</html>